package middlewares

import (
	"github.com/gin-gonic/gin"
	"wskyygyso/api/pkg/jwt"
	"wskyygyso/api/pkg/response"
)

func GuestJwt() gin.HandlerFunc {
	return func(context *gin.Context) {
		_, err := jwt.NewJwt().ParserToken(context)
		if err == nil {
			response.Unauthorized(context, "请使用游客身份访问")
			context.Abort()
			return
		}
		context.Next()
	}
}
